package com.uxwine.alarm;

import com.uxwine.cmm.UXSettings;

import android.content.Context;

public class Settings extends UXSettings
{
	public static final int HWBEHAVIOR_NONE		= 0;
	public static final int HWBEHAVIOR_SNOOZE 	= 1;
	public static final int HWBEHAVIOR_DISMISS 	= 2;
	
	public static final int SNOOZE_DURATION_DEFAULT = 5;
	
	public static final String KEY_HWBEHAVIOR = "hardware.behavior";
	/**in minutes*/
	public static final String KEY_SNOOZE_DURATION = "snooze.duration";
	
	private static Settings mInstance;

	private Settings(Context ctx)
	{
		super(ctx, "ux.alarm");
	}

	public synchronized static Settings getInstance(Context ctx)
	{
		if (null == mInstance)
		{
			mInstance = new Settings(ctx);
		}
		return mInstance;
	}
	
	public void setHWBehavior(int behavior)
	{
		editor().putInt(KEY_HWBEHAVIOR, behavior).commit();
	}
	
	public int getHWBehavior(int defValue)
	{
		return getInt(KEY_HWBEHAVIOR, defValue);
	}	
	
	public int getSnoozeDuration(int defValue)
	{
		return getInt(KEY_SNOOZE_DURATION, defValue);
	}
	
	public void setSnoozeDuration(int duration)
	{
		set(KEY_SNOOZE_DURATION, duration);
	}

	public static class Snooze extends UXSettings
	{
		public static final String KEY_ID 		= "_id";
		public static final String KEY_TIME 	= "_times";
		public static final String KEY_TRIGGER 	= "_trigger";

		public Snooze(Context ctx)
		{
			super(ctx, "ux.snooze");
		}		
	}	
}
